<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>商家列表： <font color="blue" class="text-decoration:underline">{$_total}</font> | <a href="{:U('Shop/review')}" style="color: red">{$_total2}</a></h2>
    </div>
    <div class="cf">
        <!-- 高级搜索 -->
        <div class="search-form cf fr">
            <div class="sleft">
                <input type="text" name="shopname" autocomplete="off" class="search-input" value="{:I('shopname')}" placeholder="请输入店铺名称或店铺ID">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('Shop/manage', false)}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <table class="">
            <thead>
            <tr>
                <th class="">商铺名称</th>
                <th class="">所属会员</th>
                <th class="">创建时间</th>
                <th class="">店铺积分</th>
                <th class="">已送积分</th>
                <th class="">回收积分</th>
                <th class="">状态</th>
                <th class="">操作</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="_list">
                <volist name="_list" id="vo">
                    <tr>
                        <td>{$vo.title}</td>
                        <td>{$vo.uid|get_username}</td>
                        <td>{$vo.create_time|time_format}</td>
                        <td>{$vo.score}</td>
                        <td>{$vo.give_score}</td>
                        <td>{$vo.recover_score}</td>
                        <td>
                            <if condition="$vo.review eq 1">正常
                                <elseif condition="$vo.review eq 0"/>待审核
                                <else />审核不通过
                                </if>
                            <!--<eq name="vo.review" value="1">正常<else /><font color="#ff4500">待审核</font></eq></td>-->
                        <td>
                            <a href="{:U('edit', array('id'=>$vo['id']))}">查看</a>
                            <a href="{:U('cat_order', array('id'=>$vo['id']))}">查看订单</a>
                            <a href="{:U('remove', array('id'=>$vo['id']))}" class="confirm ajax-get">刪除</a>
                        </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <script type="text/javascript">
        $(function(){
            //搜索功能
            $("#search").click(function(){
                var url = $(this).attr('url');
                var status = $("#sch-sort-txt").attr("data");
                var query  = $('.search-form').find('input').serialize();
                query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
                query = query.replace(/^&/g,'');
                if(status != ''){
                    query = 'status=' + status + "&" + query;
                }
                if( url.indexOf('?')>0 ){
                    url += '&' + query;
                }else{
                    url += '?' + query;
                }
                window.location.href = url;
            });

            //回车自动提交
            $('.search-form').find('input').keyup(function(event){
                if(event.keyCode===13){
                    $("#search").click();
                }
            });

            /* 状态搜索子菜单 */
            $(".search-form").find(".drop-down").hover(function(){
                $("#sub-sch-menu").removeClass("hidden");
            },function(){
                $("#sub-sch-menu").addClass("hidden");
            });

            $("#sub-sch-menu li").find("a").each(function(){
                $(this).click(function(){
                    var text = $(this).text();
                    $("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
                    $("#sub-sch-menu").addClass("hidden");
                })
            });

            //导航高亮
            highlight_subnav('{:U('Shop/manage')}');
        })
    </script>
</block>
